#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define db double
const int MAXN=85;
const db eps=1e-8;
int n,m,Len[MAXN],b[MAXN<<1],l[MAXN],r[MAXN];
db Ans[MAXN][MAXN],le[MAXN][MAXN<<1],eq[MAXN][MAXN<<1],mo[MAXN][MAXN<<1],len[MAXN],sum[MAXN][MAXN][MAXN],dp[MAXN][MAXN][MAXN],g[MAXN][MAXN];
db LE(int x,int y){
if(y<=l[x]) return 0.0;
if(y>=r[x]) return 1.0;
return 1.0*(y-l[x])/len[x];
}
void Push(int lev,int wz,int va){
for(int i=0;i<=Len[lev];i++){
for(int j=0;i+j<=Len[lev];j++){
g[i][j]+=dp[lev][i][j]*mo[wz][va+1];
g[i+1][j]+=dp[lev][i][j]*le[wz][va];
g[i][j+1]+=dp[lev][i][j]*eq[wz][va];
}
}
Len[lev]++;
for(int i=0;i<=Len[lev];i++){
for(int j=0;i+j<=Len[lev];j++){
dp[lev][i][j]=g[i][j];g[i][j]=0;
}
}
return;
}
void calc(int lev,int L,int R,int va){
if(L==R){
for(int i=0;i<=Len[lev];i++){
for(int j=0;i+j<=Len[lev];j++){
sum[L][i][j]+=dp[lev][i][j]*eq[L][va];
}
}
return;
}
int mid=(L+R)>>1;
Len[lev+1]=Len[lev];
for(int i=0;i<=Len[lev];i++){
for(int j=0;i+j<=Len[lev];j++){
dp[lev+1][i][j]=dp[lev][i][j];
}
}
for(int i=mid+1;i<=R;i++) Push(lev+1,i,va);
calc(lev+1,L,mid,va);
Len[lev+1]=Len[lev];
for(int i=0;i<=Len[lev];i++){
for(int j=0;i+j<=Len[lev];j++){
dp[lev+1][i][j]=dp[lev][i][j];
}
}
for(int i=L;i<=mid;i++) Push(lev+1,i,va);
calc(lev+1,mid+1,R,va);
return;
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d%d",&l[i],&r[i]);len[i]=r[i]-l[i];b[++m]=l[i];b[++m]=r[i];
}
sort(b+1,b+1+m);m=unique(b+1,b+1+m)-b-1;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
le[i][j]=LE(i,b[j]);
if(j<m) eq[i][j]=LE(i,b[j+1])-le[i][j];
mo[i][j]=1.0-LE(i,b[j]);
// printf("CAO:%d %d %lf %lf %lf\n",i,j,le[i][j],eq[i][j],mo[i][j]);
}
}
dp[0][0][0]=1;
for(int now=1;now<m;now++){
calc(0,1,n,now);
}
for(int now=1;now<=n;now++){
for(int i=0;i<n;i++){
for(int j=0;i+j<n;j++){
for(int k=0;k<=j;k++){
Ans[now][i+k+1]+=sum[now][i][j]/(j+1);
}
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
printf("%.9lf ",Ans[i][j]);
}printf("\n");
}
return 0;
}
1466C - Canine poetry | 74A - Room Leader |
1333D - Challenges in school №41 | 1475B - New Year's Number |
461A - Appleman and Toastman | 320B - Ping-Pong (Easy Version) |
948A - Protect Sheep | 387A - George and Sleep |
53A - Autocomplete | 1729G - Cut Substrings |
805B - 3-palindrome | 805C - Find Amir |
676C - Vasya and String | 1042B - Vitamins |
1729F - Kirei and the Linear Function | 25D - Roads not only in Berland |
1694A - Creep | 659F - Polycarp and Hay |
1040A - Palindrome Dance | 372A - Counting Kangaroos is Fun |
1396B - Stoned Game | 16A - Flag |
1056A - Determine Line | 670B - Game of Robots |
1418C - Mortal Kombat Tower | 1382B - Sequential Nim |
1272C - Yet Another Broken Keyboard | 808A - Lucky Year |
1245A - Good ol' Numbers Coloring | 58B - Coins |